package xyz.naokeziteng.leetcode;

import java.util.Arrays;

/**
 * 217题：判断数组中是否存在重复元素
 */
public class RepeatingElements {


    public boolean containsDuplicate(int[] nums) {
        Arrays.sort(nums);
        for (int i = 0; i < nums.length - 1; i++) {
            if (nums[i] == nums[i + 1]) {
                return true;
            }
        }
        return false;
    }
}
